//
//  CONewerDragView.swift
//  CocoProject
//
//  Created by Vill on 2023/11/16.
//

import UIKit

class CONewerDragView: WMDragView {

    lazy var dragImg: UIImageView = {
        let canva = UIImageView()
        if (kStaticStartStr.keyGetNSDefaultsKey() != nil){
            let launchStatic = kStaticStartStr.keyGetNSDefaultsKey() as! String
            let staticArr = launchStatic.components(separatedBy: ",")
            if staticArr.count > 1{
                canva.sd_setUrlImage(staticArr[1])
            }
        }
        canva.contentMode = .scaleAspectFill
        canva.layer.masksToBounds = true
        return canva
    }()
    
    lazy var priceLbl: UILabel = {
        let price = UILabel()
        price.text = "$0.99"
        price.textColor = .white
        price.font = UIFont.pingfangFont(ofSize: 13, weight: .medium)
        price.textAlignment = .center
        return price
    }()
 
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.freeRect = CGRect(x: 0, y: KStatusAndNavBarHeight + PTW(20), width: SCREENWIDTH, height: SCREENHEIGHT - KStatusAndNavBarHeight - PTW(60) - KTabBarAndSafeHeight)
        self.isKeepBounds = true
        self.dragDirection = .vertical
        setUpUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // 设置UI
    func setUpUI(){
        addSubview(dragImg)
        dragImg.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        addSubview(priceLbl)
        priceLbl.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview().offset(-PTW(2))
        }
    }

}
